package nccloud.web.hrppl.pjapplication.pjappl.action;

import java.util.Map;

import nc.vo.pub.BusinessException;
import ncc.bs.query.service.IQueryTranslateService;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.ui.model.GridModel;
import nccloud.framework.web.ui.model.row.Cell;
import nccloud.framework.web.ui.model.row.Row;
import nccloud.framework.web.ui.pattern.extbillcard.ExtBillCard;
import nccloud.framework.web.ui.pattern.grid.Grid;

public class TranslateActionUtil {
	
	/**
	 * 翻译采购页签参照
	 * @param data
	 * @return
	 * @throws Throwable CGUpdateCVOSub pjapplpSub
	 */
	public static ExtBillCard translateAggvoVO(ExtBillCard data, String tranbodyname) throws Throwable{
		Grid grid = data.getBody(tranbodyname);
		if(grid == null) return data;
		IQueryTranslateService service = ServiceLocator.find(IQueryTranslateService.class);
		GridModel gridModel = grid.getModel();
		Row[] lrows = gridModel.getRows();
		if(lrows != null) {
			for(Row row : lrows) {
				Map<String, Cell> values = row.getValues();
				if(values != null) {
					Cell celtype = values.get("vbdef1");
					if(celtype != null) {
						celtype.setDisplay(service.getFourCGProject(celtype.getValue()));
					}
				}
			}
		}
		return data;
	}
}